﻿namespace IssueVision.EntityModel
{
    /// <summary>
    /// Platform class client-side extensions
    /// </summary>
    public partial class Platform
    {
        /// <summary>
        /// Guidelines for Overloading Equals() and Operator == (C# Programming Guide)
        /// http://msdn.microsoft.com/en-us/library/ms173147%28v=vs.80%29.aspx
        /// </summary>

        public override bool Equals(object obj)
        {
            // if parameter is null return false
            if (obj == null)
            {
                return false;
            }
            // if parameter cannot be cast to Platform return false
            Platform platform = obj as Platform;
            if ((object)platform == null)
            {
                return false;
            }
            // return true if PlatformID matches
            return PlatformID == platform.PlatformID;
        }

        public bool Equals(Platform platform)
        {
            // if parameter is null return false
            if ((object)platform == null)
            {
                return false;
            }
            // return true if PlatformID matches
            return PlatformID == platform.PlatformID;
        }

        public override int GetHashCode()
        {
            return PlatformID;
        }

        public static bool operator ==(Platform a, Platform b)
        {
            // if both are null, or both are same instance, return true
            if (ReferenceEquals(a, b))
            {
                return true;
            }
            // if one is null, but not both, return false
            if (((object)a == null) || ((object)b == null))
            {
                return false;
            }
            // return true if PlatformID matches
            return a.PlatformID == b.PlatformID;
        }

        public static bool operator !=(Platform a, Platform b)
        {
            return !(a == b);
        }

        public static bool operator ==(object a, Platform b)
        {
            // if parameter a cannot be cast to Platform return false
            Platform platform = a as Platform;
            if ((object)platform == null)
            {
                return false;
            }

            return (platform == b);
        }

        public static bool operator !=(object a, Platform b)
        {
            return !(a == b);
        }
    }
}
